var guiWidth						= Screen.width;
var guiHeight			: float		= 25;
var progressIndicator	: Texture;
var currentProgress		: float;
var start				: Transform;
var end					: Transform;
var playerPos			: Transform;

function Update()
{	
	// Get total distance of level
	var totalDist	: float	= end.position.x - start.position.x;
	
	// Get player distance from start
	var playerDist	: float	= playerPos.position.x - start.position.x;
	
	// Convert to percentage
	var playerProg	: float	= playerDist/totalDist * 100;
	
	// Apply % comparative to scale of progress bar
	currentProgress = playerProg/100 * guiWidth/2;
}

function OnGUI()
{
	if(changeView.startCamera == 1)
	{
		// Start GUI group
		GUI.BeginGroup(new Rect(15, 10, guiWidth/2, guiHeight));
		
		// Display Progress Bar GUI Box
		GUI.Box(Rect(0, 0, guiWidth/2, guiHeight), "");
		
		// Progress Indicator
		GUI.Label(Rect(currentProgress, 0, progressIndicator.width, progressIndicator.height), progressIndicator);
		
		GUI.EndGroup();
	}
}